package com.myph.model;

import android.os.Handler;
import android.os.Message;
import android.util.Log;

public class SocketListener {
    int percent;
    int errorFlag;
    Handler handler;
    void recordProgress(int percentIn){
        percent = percentIn;
        Message msg = new Message();
        msg.what = 1;
        msg.arg1 = percent;
        handler.sendMessage(msg);
        Log.d("Listener",""+msg.arg1);
    }
    void onError(Exception e){
        e.printStackTrace();
        errorFlag = -1;
        Message msg = new Message();
        msg.what = 2;
        msg.arg1 = -1;
        handler.sendMessage(msg);
        Log.d("Listener fail",""+percent);
    }
    void onError(){
        errorFlag = -1;
    }
    public SocketListener(int p,int eno,Handler h) {
        percent = p;
        errorFlag = eno;
        handler = h;
    }
    public SocketListener(Handler h){
        percent = 0;
        errorFlag = 0;
        handler = h;
    }
}
